package org.sklse.lab.service;

import org.sklse.lab.bean.Commodity;
import org.sklse.lab.dao.CommodityRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommodityService {
    @Autowired
    CommodityRepository commodityRepository;

    public List<Commodity> findAll(){
      return commodityRepository.findAll();
  }

     public Commodity findById(String CommodityId){
        return commodityRepository.findByCommodityId(CommodityId);
     }

     public void save(Commodity commodity) {
         commodityRepository.save(commodity);
     }
}
